package com.test.kotlin05


class Player3(
    _name:String,
    var age:Int,
    var isNormal:Boolean //在主构造函数里定义属性
) {
    var name = _name
        get() = field.capitalize()
        set(value){
            field = value.trim()
        }


    constructor(name:String):this(name,age =10,isNormal =false)//次构造函数


    constructor(name:String,age: Int):this(name,age =10,isNormal =false){
        this.name = name.toUpperCase()
    }



}


fun main() {
    val player:Player3 = Player3("jack",18,true)

    println(player.name)


    val p2:Player3 = Player3("Rose")
    val p3:Player3 = Player3("Rose",18)
}